(function(app){
	app
		.controller("content_check_mainCtrl",["$scope","$rootScope","myFactory",'$http','$stateParams','$state','$timeout','$ionicHistory',function($scope,$rootScope,myFactory,$http,$stateParams,$state,$timeout,$ionicHistory){

			//参数接收、定义
			var item=$stateParams.item; //接受之前页面的更改，用于接下来传到后台保存缓存的方法saveContentItem，如果没有更改数据，不需要传送过来
			var taxData=$stateParams.taxData; //接受之前个人税收页面的更改，用于接下来传到后台保存缓存的方法saveContentItem，如果没有更改数据，不需要传送过来
			if(taxData==null){
				taxData="";
			}
			var chdrnum01=$stateParams.chdrnum01;
			var chdrcoy = $stateParams.chdrcoy;
			var searchParam = $stateParams.searchParam;
			var strSelectedBdh = $stateParams.strSelectedBdh;
			if(strSelectedBdh==null || strSelectedBdh ==undefined  ){
				strSelectedBdh = "";
			}
			var itemId=$stateParams.itemId;
			var itemid = ""; //这个与上面的区分开来，上面的是从别的路由得到，而这个是要从action中返回回来得到的，用于校验，具体校验函数tonoteVerify
			var itemData=""; //后台保存方法saveContentItem执行完后，返回的itemData包括很多数据，包括每一项的更改缓存item01、item36等
			var policy="";//保单
			var sysMsg = "";      //    系统信息，如果后台传上来false，则要弹框提示系统繁忙
			var noteEmpty = "0" ; //	不存在照会
			var noteFlag="";	  //	照会返回的类型${noteFlag}
			var count="";	      //	变更项目的个数${itemCount}
			var telephone="";     //    获取手机号码${telephone}
			var _chargeFlag = "" ; //	收退费标示 ${chargeFlag}
			//var _itemIds = "${strItemIds}";	//	变更项目
			var sprovid= "";     //校验所需字段
			var scityid= "";     //校验所需字段
			var initFlag = false;//检测初始化是否完成标志
			var token=sessionStorage.getItem("token");
			//绑定信息
			$scope.item=$stateParams.item;
			$scope.chdrnum01=$stateParams.chdrnum01;
			$scope.isEndMainPage =false;//只有endMain页面，嵌入页面才显示显示标题
			//$scope.showBbrFlag = false;
			$scope.FlagFor40Check =false;//控制是否显示其他的 “生存给付方式”模块消息，默认不显示

			/*任务17 额外投资，标志初始化begin*/
			$scope.InvAmntFlag = false; //万能区域，隐藏
			$scope.UniAmntFlag = false; //投连区域：金额，显示
			$scope.AcctFlag = false;    //投连区域：产品选择区域，显示
			/*任务17 额外投资，标志初始化end*/
			
			/*任务21部分提取，标志初始化begin*/
			$scope.universalDiv21CheckFlag = false;
			$scope.investDiv21CheckFlag = false;
			/*任务21部分提取，标志初始化end*/
			/*S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by yangyan 20190712 start*/
			$scope.changeFlag = false;
			/*S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by yangyan 20190712 end*/
			
			/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 start*/
			$scope.peoRelationFlag = false;
			/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 end*/
			
			//S2019060408807保全退保项目删除预估应退金额需求 add by yangyan 20200213 start
			$scope.payFeeShowFlag = true;
			$scope.refundedShowFlag = false;
			//S2019060408807保全退保项目删除预估应退金额需求 add by yangyan 20200213 end
          //S2018122906735移动保全新增变更项目及功能的优化需求 add by huanghaokun 20220317 start
            $scope.newBenefit = false;
          //S2018122906735移动保全新增变更项目及功能的优化需求 add by huanghaokun 20220317 end
			
			$scope.data = {
				showFlag: false,
				changeList: [
				]
			}

			/*$scope.load = function () {
				alert("运行初始化函数");
				//初始化函数：
				app.directive('content23',function(){
					return {
						restrict: 'EA',		//指明指令在DOM里面以什么形式被声明,EA.表示即可以是元素也可以是属性
						templateUrl: 'html/input/input_check/check_01_content.html',
						replace: true,		//设置解析后，DOM声明的指令是否消失
						link: function(scope,element,attrs){  //链接函数负责注册DOM事件和更新DOM,
							console.log('check-23-content指令完成');
						}
					}
				});
			}*/

			//var str = JSON.stringify(item);
			//var itemCommonList="";
			$scope.load = function () {
				//单项变更内容确认指针模板标志(默认隐藏)
				$scope.data.showFlag=false;//隐藏多项变更内容列表
				$scope.showZhaohuiFlag=false;
				myFactory.loadingShow();
				//$timeout(function(){myFactory.loadingHide();},2000);
				var timestamp=myFactory.getTimetamp();
				var sfis= "itemId-token-timestamp";
				var signStr="itemId="+itemId+"&token="+token+"&timestamp="+timestamp;//encodeURI(name)
				var sign = myFactory.hex(signStr);
				//如果变更项10的被保人身份被更改，传递后台进行被保人身份更改标志保存 add by csf start
				if ( 1 == sessionStorage.getItem("isChange_insured_item10") ){
					$http({
						method: 'GET',
						url: app.domain + 'input/saveContentItem'+itemId+'.action',
						headers:{'item10_LF_Change':'U'},
						params: {'itemId': itemId,'itemStr':item,"strSelectedBdh":strSelectedBdh,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
                    }).then(successCallback, errorCallback);
                }
                //S2018122906735移动保全新增变更项目及功能的优化需求 add by yangyan 20201021 start
                else if (itemId == '15') {
					var sfis= "token-timestamp";
					var signStr="token="+token+"&timestamp="+timestamp;//encodeURI(name)
					var sign = myFactory.hex(signStr);
					var changeItem15_increment = sessionStorage.getItem("changeItem15_increment");
					var params15Map={
							"itemId":itemId,
							"itemStr":item,
							"changeItem15_increment":changeItem15_increment
							};
					$http({
						method: 'post',
						url: app.domain + 'input/saveContentItem15.action',
						data:{paramsMap:params15Map,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
					}).then(successCallback, errorCallback);
                }
                //S2018122906735移动保全新增变更项目及功能的优化需求 add by yangyan 20201021 end
                else {
					$http({
						method: 'GET',
						url: app.domain + 'input/saveContentItem'+itemId+'.action',
						params: {'itemId': itemId,'itemStr':item,"strSelectedBdh":strSelectedBdh,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
					}).then(successCallback,errorCallback );
				}
			}
			function errorCallback(response) {
				myFactory.loadingHide();
				//S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
//				myFactory.alert('','查询数据发生异常！','info');
				myFactory.alert('','连接服务器超时，请稍后重试！','info');
				//S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
			}
			function successCallback(response) {
				if (response.data.success) {
					itemData=response.data.data.itemData;
					policy=response.data.data.policy;
					$scope.currentItemName = itemData.currentItemName;
					$scope.itemCommonList=response.data.data.itemData.itemCommonList;
					$scope.strItemIds=response.data.data.itemData.strItemIds;
					$scope.zhaohuiInfo=response.data.data.itemData.noteList; //照会信息list

						itemid = response.data.data.itemid;
						sysMsg = itemData.sysMsg;
						noteFlag = itemData.noteFlag;
						count = itemData.itemCount;
						telephone = itemData.telephone;
						_chargeFlag = itemData.chargeFlag;

						if(policy!="" && policy!=null && policy!=undefined){
							sprovid = policy.sprovid;
							scityid = policy.scityid;
						}

						//如果系统返回信息为false，弹框提示系统繁忙，禁用添加多个变更、下一步按钮
						if(sysMsg==false){
							myFactory.alert("","目前系统繁忙，请返回再试！","info");
							$("#add_more_change").addClass("disabled");
							//$("#prev").addClass("disabled");
							$("#next").addClass("disabled");
						}
						//判断是否显示照会信息
						if($scope.zhaohuiInfo!="" && $scope.zhaohuiInfo!=undefined){
							//$("#zhHidenId").show();
							$scope.showZhaohuiFlag=true;
						}
						//存在收费且存在退费时控制页面不做任何操作，即存在收退费时候，三个按键都不允许使用
						if( "2" == _chargeFlag ){
							myFactory.alert("","本次变更存在收付费信息，请确认！","info");
							$("#add_more_change").addClass("disabled");
							$("#prev").addClass("disabled");
							$("#next").addClass("disabled");
						}

						var strItemIds=response.data.data.itemData.strItemIds;
						if(""!=strItemIds){
							var strItemIdsSplit=strItemIds.split(",");
							if(strItemIdsSplit.length==1){//控制列表隐藏，显示单列表界面
								//显示当前itemId-->指针【再封装一个方法显示具体哪一个指针】
								console.log("单个变更确认---->>>");

								/**********************************测试阶段使用begin****************************/
								/*if(app.openFlag=='openAll'){
									console.log("Permission：开发人员");
									$scope.data.showFlag=true;//开发测试,【备注：上传svn必须还原为false】
								}else if(app.openFlag=='openTest'){
									console.log("No Permission：测试人员");
									$scope.data.showFlag=false;//隐藏多项变更内容列表
								}*/
								$scope.data.showFlag=false;//隐藏多项变更内容列表
								/**********************************测试阶段使用end****************************/

							//$scope.data.showFlag=false;//隐藏多项变更内容列表
							//$scope.data.showFlag=true;//开发测试,【备注：上传svn必须还原为false】
							showSingleItem(itemId);
						}else{
							$scope.data.showFlag=true;//显示多项变更内容列表
						}
					}
					initFlag = true;
				}
//				myFactory.alert('','查询数据发生异常，请返回重试！','info');
				myFactory.loadingHide();
			}
			//如果变更项10的被保人身份被更改，传递后台进行被保人身份更改标志保存 add by csf end
			//关闭遮罩
			$scope.overwindowClose = function(){
				//$(".overwindow").show();
				$(".overwindow").hide();
				$(".overmodal").hide();
			}
			
			//重新受理
			$scope.renew = function(){
				myFactory.renew();
			}
			//退出移动保全
			$scope.exit = function(){
				myFactory.exit();
			}
			//添加其他变更
			$scope.addMoreChange = function(){
				/*$.confirm("是否需同时办理其他变更项？", "保单：21098871", function() {
					alert('按了确认');
					document.location.href=basePath+"/input/initSelectItem.action";
				}, function() {
					alert('按了取消');
				});*/
				if(noteFlag=="A"){
					myFactory.alert("","本次变更不符合保全规则！","info");
					$("#add_more_change").addClass("disabled");
					$("#next").addClass("disabled");
				}else{
					$.confirm("是否需同时办理其他变更项目？", "保单："+$scope.chdrnum01, function() {
						//暂时屏蔽
						//alert('功能正在完善中......');
						/*$state.go('content_select',{
							chdrnum01:$scope.chdrnum01,chdrcoy:chdrcoy
						});*/
						$ionicHistory.clearCache().then(function(){
							$state.go('content_select',{
								chdrnum01:$scope.chdrnum01,chdrcoy:chdrcoy
							});
						})
					});
				}
			}

			$scope.goBack = function () {
				//history.go(-1);
				//$("#hidenId").hide();
				/**
				 * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）
				 * 新增签约接口的逻辑 add by csf 20180926 start
				 */
				if($rootScope['flag']  =='1' || $rootScope['flag']  =='2' ){ 
					$rootScope['flag'] ='';
					$ionicHistory.goBack(-2);
				} else{
					myFactory.goBack();
				}
				/**
				 * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）
				 * 新增签约接口的逻辑 add by csf 20180926 end
				 */
				//myFactory.goBack();
				/*$ionicHistory.clearCache().then(function(){
					myFactory.goBack();
				})*/
			}

			$scope.nextStep = function () {
				myFactory.loadingShow();//出现加载圈
				if(!initFlag){
					myFactory.alert("","初始化时失败，请返回上一步重试","info");
					myFactory.loadingHide();
					return false;
				}
				//进行校验
				tonoteVerify();
			}
			
			function tonoteVerify(){
				if((itemid=="55"||itemid=="27")&&scityid=="open"){
					myFactory.loadingHide();
					//浙江单弹框
					modal('open','zhejiangPop','overwindowOnCheckMain','zhejiangPopCloseX');
				}
				else{
					$scope.noteVerify();
				}
			}

			$scope.noteVerify = function(){
				//当跳到这里时候，首先默认关闭可能是经由浙江弹框跳到这边的
				$scope.zhejiangPopCancel();
				if(noteFlag==noteEmpty){
					if(telephone==""){
						//提示没有电话弹框
						myFactory.loadingHide();
						$.confirm("手机号码为空，是否变更通讯资料？", "", function() {
							$scope.toItem01();
						});
					}else {
						//S2018122906735移动保全新增变更项目及功能的优化需求 update by yangyan 20200428 start
                        //被保险人职业、保险计划、减额缴清、取消承保条件、补充告知  结案类型仅受理，转人工
                        if ($scope.strItemIds.indexOf("15")>-1 || $scope.strItemIds.indexOf("29")>-1 || $scope.strItemIds.indexOf("30")>-1 ) {
                            myFactory.loadingHide();
                            $.confirm("客户本次变更需转人工审核，是否继续提交？", "", function() {
                                $scope.comfirmBPop();
                            });
                        }else{
                        	$scope.requestForNextPage();
                        }
                        //S2018122906735移动保全新增变更项目及功能的优化需求 update by yangyan 20200428 end
					}			
				}else if(noteFlag=="A"){
					myFactory.loadingHide();
					myFactory.alert("","本次变更不符合保全规则！","info");
					$("#add_more_change").addClass("disabled");
					$("#next").addClass("disabled");
				//S2018122906735移动保全新增变更项目及功能的优化需求 add by yangyan 20200428 start
                } else if (noteFlag == "B" || noteFlag == "C" || $scope.strItemIds.indexOf("15")>-1
                		|| $scope.strItemIds.indexOf("29")>-1 || $scope.strItemIds.indexOf("30")>-1) {
                //S2018122906735移动保全新增变更项目及功能的优化需求 add by yangyan 20200428 end
					myFactory.loadingHide();
					$.confirm("客户本次变更需转人工审核，是否继续提交？", "", function() {
						$scope.comfirmBPop();
					});
				}
			}
			
			//当电话为空，点击是时，跳转去修改通讯资料变更，这里只做跳转到选择页面
			$scope.toItem01 = function(){
//				console.log(searchParam);
//				$ionicHistory.clearCache().then(function(){
//				$state.go('content_01_input',{
//					changeTypeId:"01",
//					chdrnum01:chdrnum01,
//					chdrcoy:chdrcoy,
//					searchParam:searchParam
//				});
				$ionicHistory.clearCache().then(function(){
					$state.go('content_select',{
						chdrnum01:$scope.chdrnum01,chdrcoy:chdrcoy
					});
				})
			}
			
			//当需要转人工审核，点击是时，执行的函数
			$scope.comfirmBPop = function(){
				if(telephone==""){
					//提示没有电话弹框
					$.confirm("手机号码为空，是否变更通讯资料？", "", function() {
						$scope.toItem01();
					});
					//modal('open','telPop','overwindowOnCheckMain','telPopCloseX');
				}else {
					//访问后台决定跳转方向
					$scope.requestForNextPage();
				}
			}
			
			//访问后台action判断应该跳转方向的函数
			$scope.requestForNextPage = function(){
				var token=sessionStorage.getItem("token");
				var timestamp=myFactory.getTimetamp();
				var sfis= "itemId-token-timestamp";
				var signStr="itemId="+itemId+"&token="+token+"&timestamp="+timestamp;//encodeURI(tbrName)
				var sign = myFactory.hex(signStr);
				myFactory.loadingShow();
				$http({
					method: 'GET',
					url: app.domain + 'history/restSaveContent.action',
					params: {'itemId': itemId,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
				}).then(function successCallback(response) {
					if (response.data.success) {
						//得到下一步的动作
						var nextAction = response.data.data.nextAction;//eg:charge/restInit.action 或者 img/gotoSignMain.action
						var chargeFlag = response.data.data.chargeFlag; //0的话直接跳转签名，1代表要跳到收付费
						
						if("0"==chargeFlag){//没有收付费内容，直接跳签名留影
							/*签名留影*/
							$http({
								method: 'GET',
								url: app.domain + nextAction,
								params: {"itemId": itemId,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
							}).then(function successCallback(response) {
								if (response.data.success) {
									var signMainData = response.data.data.signMainData;
									//判断投保人被保人是否同一个人，是的话，即使更新了10变更项，也仍然不需要被保人签名 add by csf start
									var isSamePerson = response.data.data.isSamePerson;
									//判断投保人被保人是否同一个人，是的话，即使更新了10变更项，也仍然不需要被保人签名 add by csf end
									myFactory.loadingHide();
									if(signMainData!=undefined && signMainData!=null && signMainData!=""){
										$state.go('photo_sign',{
											itemId:itemId,
											chdrnum01:chdrnum01,
											chdrcoy:chdrcoy,
											signMainData:signMainData,
											//判断投保人被保人是否同一个人，是的话，即使更新了10变更项，也仍然不需要被保人签名 add by csf start
											isSamePerson:isSamePerson
											//判断投保人被保人是否同一个人，是的话，即使更新了10变更项，也仍然不需要被保人签名 add by csf end
										});
									}
								}else{
									myFactory.loadingHide();
									myFactory.alert("","访问后台出错，请稍后再试!","info");
								}
							}, function errorCallback(response) {
								myFactory.loadingHide();
								myFactory.alert("","访问后台出错，请稍后再试!","info");
							});
						}else if("1"==chargeFlag){ //存在收退费情况时候进入这里
							
							//S2018051403895_信易通人证合一及活体检测项目需求 add by rqyang 20180729 begin
							var idTypeAndCharge = response.data.data.idTypeAndCharge;
							var isNewHighRefundFeeFlag = "";
							if(idTypeAndCharge!=undefined && idTypeAndCharge!=null && idTypeAndCharge!=""){
								isNewHighRefundFeeFlag=idTypeAndCharge.isNewHighRefundFeeFlag;
								console.log("isNewHighRefundFeeFlag="+isNewHighRefundFeeFlag);
							}
							//S2018051403895_信易通人证合一及活体检测项目需求 add by rqyang 20180729 end
							
							//这里跳转下一个action restInit.action
							$http({
								method: 'GET',
								url: app.domain + nextAction,
								params: {"itemId": itemId,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
							}).then(function successCallback(response) {
								if (response.data.success) {
									var pageData = response.data.data.pageData;
									var charge = pageData.charge;
									var intime = pageData.intime;
									var message = pageData.message;
									var type = charge.type;

									if(message!=undefined && message!=null && message!="" && message=="success" ){
										//如果是success这种情况，说明保存成功，这里直接跳转签名
										/*myFactory.alert("","message为success时，这里跳到签名","info");*/
										/*签名留影*/
										$http({
											method: 'GET',
											url: app.domain + nextAction,
											params: {"itemId": itemId,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
										}).then(function successCallback(response) {
											if (response.data.success) {
												var signMainData = response.data.data.signMainData;
												myFactory.loadingHide();
												if(signMainData!=undefined && signMainData!=null && signMainData!=""){
													$state.go('photo_sign',{
														itemId:itemId,
														chdrnum01:chdrnum01,
														chdrcoy:chdrcoy,
														signMainData:signMainData
													});
												}
											}else{
												myFactory.loadingHide();
												myFactory.alert("","访问后台出错，请稍后再试!","info");
											}
										}, function errorCallback(response) {
											myFactory.loadingHide();
											myFactory.alert("","访问后台出错，请稍后再试!","info");
										});
									}else{//没有进入上面情况说明还没做保存收付费信息，或者操作失败
										if(intime!=undefined && intime!=null && intime!=""){
											//这里进入实时缴费界面,第一遍运行时，intime传到后台这个值是空的，绝对不会在此处进入实时缴费页面
											//myFactory.alert("","这里进入实时缴费界面","info");
											myFactory.loadingHide();
										}else{//非实时缴费时
											/***********************************生存给付特别模块begin*********************************************/
											var isCSWD ="";
											if(itemData.item40!=null && itemData.item40!=undefined &&  itemData.item40!=""){
												isCSWD = itemData.item40.beneList[0].zdivOpt;
											}
											if(itemId == "39" || (itemId=="40" && "CSWD"==isCSWD)){//单独逻辑，如果是生存给付确认，或者生存领取方式变更，省略跳转退费页面，以下代码可能有一些是针对全体的
												var user = pageData.user;
											  	var userType = "";	//	用户类型
												var itemIds = charge.itemIds;
												var _receipt = charge.receiptAmount;	//	实际金额
												var Type = charge.type;//类型
												var beneClntNum = pageData.beneClntNum.trim();//权益人编号
												var beneName = pageData.beneName.trim();//权益人
												
											  	if(user!=null && user!="" && user!=undefined){
													userType = user.userType;
											  	}
											  	
												//控制是否大于50万[退费总金额大于50万时不能操作下一步按钮]
												//if( userType=="market" ){ //当用户的类型是market的时候，执行以下部分，_receipt是实际金额，已经在上面定义
											  	//S2018051403895_信易通人证合一及活体检测项目需求 取消原B/A/AA/AAA级营销员对应可受理退费金额20万/30万/40万/50万的限制规则 add by rqyang 20180728 begin
											  	if("Y"!=isNewHighRefundFeeFlag){//走人脸识别流程,则去除限额校验
											  		if( userType=="AG" ){	
											  			var userGrade = user.userGrade;
											  			var isOverAmt = false;
											  			
											  			if( _receipt >= 500000 && userGrade=="3" ){//等级为3时，大于50W不能操作
											  				isOverAmt = true;
											  			}
											  			if( _receipt >= 400000 && userGrade=="2" ){//等级为2时，大于40W不能操作
											  				isOverAmt = true;
											  			}
											  			if( _receipt >= 300000 && userGrade=="1" ){//等级为1时，大于30W不能操作
											  				isOverAmt = true;
											  			}
											  			if( _receipt >= 200000 && userGrade=="B" ){//等级为B时，大于20W不能操作
											  				isOverAmt = true;
											  			}
											  			if( isOverAmt ){
											  				//	显示提示内容
											  				myFactory.alert("","本次变更的退费金额已超出授权额度，为保证客户资金安全，请客户亲临客服柜台办理。","info");
											  				//	设置[下一步]与[添加其他变更]按钮不可操作  
											  				$("#add_more_change").addClass("disabled");
											  				//$("#prev").addClass("disabled");
											  				$("#next").addClass("disabled");
											  				myFactory.loadingHide();
											  				return false
											  			}
											  		}
											  	}
												//S2018051403895_信易通人证合一及活体检测项目需求  取消原B/A/AA/AAA级营销员对应可受理退费金额20万/30万/40万/50万的限制规则 add by rqyang 20180728 end

//												//如果变更项目中包含 39、40、47、43业务，则账户持有者为权益人
//												for(var i=0;i<itemIds.length;i++){
//													var tmp = parseInt(itemIds[i]);
//													if(tmp == 39 || tmp == 40 || tmp == 47 || tmp == 43){
//														beneFlag = true;
//														break;
//													}
//												}
//												if(beneFlag){  //如果权益人标是true，那么授权其他账户中，户名就显示为是beneClntNum，否则默认是投保人的编号
//													$("#paynum").val(beneClntNum);//这些已在数据包装中直接填入
//													$("#paynme").val(beneName); 
//										  			$("#paynmeFlag").val('3');}
//												}
												
												/*var item39 = itemData.item39;  变更为针对多个项目
											    var	item39PageData = itemData.item39PageData;*/
												var itemInfo = null;
												var itemPageData = null;
												if(itemId == "39"){
													itemInfo = itemData.item39;
													itemPageData = itemData.item39PageData;
												}
												if(itemId == "40"){
													itemInfo = itemData.item40;
													itemPageData = itemData.item40PageData;
												}
												
												
												//数据包装
												var pageData2 = {//不同于支付页面，这里只需要填写关于（授权其他账户）部分的就可以了，而这部分的数据取自39input页面传过来的数据即可
														"accountFlag":"2",//授权其他账户，类型是2
														"bankacctkey":itemInfo.beneList[0].accountNum,//填写的银行账户
														"bankacctkeyCon":itemInfo.beneList[0].accountNum,
														"bankcode":itemInfo.beneList[0].recevieBank,//银行代码
														"bankdesc":itemInfo.beneList[0].recevieBankDesc,
														"beneClntNum":beneClntNum,
														"chargeType":"2",//退费页面固定2
														"city":itemPageData.bankCityCode,//开户城市代码
														"citydesc":itemInfo.beneList[0].bankCityName,//开户城市名称
														"itemIds":itemIds,
														"paynme":beneName,
														"paynmeFlag":"3",//权益人固定是3
														"paynum":beneClntNum,//权益人固定是权益人编号
														"receiptAmount":_receipt,//金额
														"type":Type
													}
//												console.log(pageData2);
												//数据提交后台，成功的话跳转即可
												
//												$ionicHistory.clearCache().then(function(){ 
//													$state.go('charge_refund_preview',{
//														itemId:itemId,
//														chdrnum01:chdrnum01,
//														chdrcoy:chdrcoy,
//														pageData:pageData,
//														pageData2:pageData2,
//														itemCommonList :  $scope.itemCommonList,
//													    strItemIds : $scope.strItemIds
//													});
//												})
												
												$http({
													method: 'GET',
													url: app.domain + 'charge/restSave.action',
													params: {'itemId': itemId,'chargeStr': pageData2,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
												}).then(function successCallback(response) {
													if (response.data.success) {
														var DataSave = response.data.data.pageData;
														var nextStep= DataSave.nextStep;//"charge/restInit.action";
														var message = DataSave.message;//用于检测实时缴费是否成功
														
														var sfisCharge= "itemId-message-token-timestamp";
														var signStrCharge="itemId="+itemId+"&message="+message+"&token="+token+"&timestamp="+timestamp;//encodeURI(tbrName)
														var signCharge = myFactory.hex(signStrCharge);
														//提交后台保存后，再次跳转到restInit.action，这次附带上检测标志的message
														$http({
															method: 'GET',
															url: app.domain + nextStep,
															params: {"itemId": itemId,"message":message,'sign':signCharge,'sfis':sfisCharge,'token':token,'timestamp':timestamp}
														}).then(function successCallback(response) {
															if (response.data.success) {
																var Data = response.data.data.pageData;
																var charge = Data.charge;
																var intime = Data.intime;
																var message = Data.message;
																var policyFor39 = pageData.policy;//获得缓存保单
																var strItemIds= itemData.strItemIds;
																//以下这段逻辑跟check_mainCtrl中相似，一般来说，这里返回回来一定会得到message的结果，然后直接跳签名
																if(message!=undefined && message!=null && message!="" && message=="success" ){
																	//如果是success这种情况，表示保存成功，这里直接跳转签名
//																	myFactory.alert("","message为success时，这里要跳到签名，暂时先跳到end_main","info");
//																	$state.go('end_main',{
//																		itemId:itemId,
//																		chdrnum01:chdrnum01,
//																		chdrcoy:chdrcoy,
//																		itemCommonList:$scope.itemCommonList,
//																	    strItemIds:strItemIds,
//																	    policy:policyFor39,
//																	    endData:itemData
//																	});
																	/*签名留影*/
																	$http({
																		method: 'GET',
																		url: app.domain + "img/gotoSignMain.action",
																		params: {"itemId": itemId,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
																	}).then(function successCallback(response) {
																		if (response.data.success) {
																			var signMainData = response.data.data.signMainData;
																			if(signMainData!=undefined && signMainData!=null && signMainData!=""){
																				myFactory.loadingHide();
																				$state.go('photo_sign',{
																					itemId:itemId,
																					chdrnum01:chdrnum01,
																					chdrcoy:chdrcoy,
																					signMainData:signMainData
																				});
																			}
																		}else{
																			myFactory.loadingHide();
																			myFactory.alert("","数据提交后台时候出错，请返回重新尝试!","info");
																		}
																	}, function errorCallback(response) {
																		myFactory.loadingHide();
																		myFactory.alert("","访问后台出错，请稍后再试!","info");
																	});
																}else{
																	myFactory.loadingHide();
																	myFactory.alert("","数据提交后台时候出错，请返回重新尝试!","info");
																}
															}else{
																myFactory.loadingHide();
																myFactory.alert("","数据提交后台时候出错，请返回重新尝试!","info");
															}
														}, function errorCallback(response) {
															myFactory.loadingHide();
															myFactory.alert("","数据提交后台时候出错，请返回重新尝试!","info");
														});
													}else{
														myFactory.loadingHide();
														myFactory.alert("","数据提交后台时候出错，请返回重新尝试!","info");
													}
												}, function errorCallback(response) {
													myFactory.loadingHide();
													myFactory.alert("","数据提交后台时候出错，请返回重新尝试!","info");
												});
												
												/***********************************生存给付特别模块end*********************************************/
											}else{
												if(type=="R"){//收费，跳到页面charge_fee
													//myFactory.alert("","这里之后要跳到收费界面","info");
													console.log("enter 收费 page....");
													myFactory.loadingHide();
                                        			//S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20200901 start
                                                    var isSamePerson = response.data.data.pageData.isSamePerson;
													$ionicHistory.clearCache().then(function(){
														$state.go("charge_fee",{
															itemId:itemId,
															chdrnum01:chdrnum01,
															chdrcoy:chdrcoy,
															pageData:pageData,
															itemCommonList : $scope.itemCommonList,
                                                            strItemIds: $scope.strItemIds,
                                                            isSamePerson:isSamePerson
														});
													})

                                        			//S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20200901 end
												}else if(type=="P"){//退费，跳到页面charge_refund
													myFactory.loadingHide();
													$ionicHistory.clearCache().then(function(){
														$state.go("charge_refund",{
															itemId:itemId,
															chdrnum01:chdrnum01,
															chdrcoy:chdrcoy,
															pageData:pageData,
															itemCommonList : $scope.itemCommonList,
														    strItemIds : $scope.strItemIds
														});
													})
												}else{//其他情况，如""，要跳签名action，不是以上的情况的话,type会是个空值
													//myFactory.alert("","类型为2，收付费都有，直接跳签名","info");
													$http({
														method: 'GET',
														url: app.domain + nextAction,
														params: {"itemId": itemId,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
													}).then(function successCallback(response) {
														if (response.data.success) {
															var signMainData = response.data.data.signMainData;
															myFactory.loadingHide();
															if(signMainData!=undefined && signMainData!=null && signMainData!=""){
																$state.go('photo_sign',{
																	itemId:itemId,
																	chdrnum01:chdrnum01,
																	chdrcoy:chdrcoy,
																	signMainData:signMainData
																});
															}
														}else{
															myFactory.loadingHide();
															myFactory.alert("","访问后台出错，请稍后再试!","info");
														}
													}, function errorCallback(response) {
														myFactory.loadingHide();
														myFactory.alert("","访问后台出错，请稍后再试!","info");
													});
												}
											}
											
										}
									}
								}else{
									myFactory.loadingHide();
									myFactory.alert("","访问后台出错，请稍后再试!","info");
								}
							}, function errorCallback(response) {
								myFactory.loadingHide();
								myFactory.alert("","访问后台出错，请稍后再试!","info");
							});
						}
						/*********** 《S2019091010023 移动保全限制湖南分公司使用被保人账号进行保全缴费系统需求》 add by yangyan 20200318 start***********/
						//myFactory.loadingHide();
						/*********** 《S2019091010023 移动保全限制湖南分公司使用被保人账号进行保全缴费系统需求》 add by yangyan 20200318 start***********/
					}else{
						myFactory.loadingHide();
						myFactory.alert("","访问后台出错，请稍后再试!","info");
					}
				}, function errorCallback(response) {
					myFactory.loadingHide();
					myFactory.alert("","访问后台出错，请稍后再试!","info");
				});
			}
			
			//变更后项目内容
			$scope.showChangeInfo = function(itemId){
				if(itemId=="01"){//通讯资料变更
					//content_01_check({itemData:itemData,chdrnum01:chdrnum01,item:item})
					var item01=itemData.item01;
					$state.go('content_01_check',{
						item01:item01,
						chdrnum01:chdrnum01,
						chdrcoy:chdrcoy,
						item:item,
						state:"content_check_main"
					});
				}
				if(itemId=="02"){//变更续期转账账户
					$state.go('content_02_check',{
						itemData:itemData,
						chdrnum01:chdrnum01,
						item:item
					});
				}
				if(itemId=="02_1"){//进入变更续期转账账户
					var item02_1=itemData.item02_1;
					$state.go('content_02_1_check',{
						itemId:itemId,
						item02_1:item02_1,
						chdrnum01:$scope.chdrnum01,
						chdrcoy:chdrcoy
					});
				}
				if(itemId=="02_2"){//进入终止续期转账授权
					var item02_2=itemData.item02_2;
					$state.go('content_02_2_check',{
						itemId:itemId,
						item02_2:item02_2,
						chdrnum01:$scope.chdrnum01,
						chdrcoy:chdrcoy
					});
				}
				if(itemId=="03"){//进入变更签名
					var item03=itemData.item03;
					if(item03.signroleNm.trim()=="被保人签名"){
						item03.signroleNm = "被保险人签名";
					}
					$state.go('content_03_check',{
						itemId:itemId,
						item03:item03,
						chdrnum01:$scope.chdrnum01,
						chdrcoy:chdrcoy
					});
				}
				if(itemId=="04"){//缴费方式
					var item04=itemData.item04;
					$state.go('content_04_check',{
						itemId:itemId,
						item04:item04,
						chdrnum01:$scope.chdrnum01,
						chdrcoy:chdrcoy
					});
				}
				if(itemId=="05"){//变更现金红包领取方式
					var item05=itemData.item05;
					$state.go('content_05_check',{
						itemId:itemId,
						item05:item05,
						chdrnum01:$scope.chdrnum01,
						chdrcoy:chdrcoy
					});
				}
				if(itemId=="06"){//保费逾期未付   保险费逾期未付选择
					var item06=itemData.item06;
					$state.go('content_06_check',{
						itemId:itemId,
						item06:item06,
						chdrnum01:$scope.chdrnum01,
						chdrcoy:chdrcoy
					});
				}
				if(itemId=="08"){//身故受益人
					var item08=itemData.item08;
					$state.go('content_08_check',{
						itemId:itemId,
						item08:item08,
						chdrnum01:$scope.chdrnum01,
						chdrcoy:chdrcoy
					});
				}
				if(itemId=="10"){//更改个人身份资料
					var item10 = itemData.item10;
					/*var clientCount=itemData.item10.clientCount;
					$scope.client_LF = itemData.item10.clientList[0];
					if(clientCount>1){
						$scope.show10TbrFlag=true; //显示更改个人身份资料-投保人
						$scope.client_OW = itemData.item10.clientList[1];
					}*/
					$state.go('content_10_check',{
						chdrnum01:chdrnum01,
						chdrcoy:chdrcoy,
						item10:item10,
					});
				}
				if(itemId=="12_42" || itemId=="12" || itemId=="42"){//补发尊贵客户卡
					var item42=itemData.item42;
					var item12=itemData.item12;
					if((item42==undefined || item42=="")){//投保人
						item42="";
					}
					if((item12==undefined || item12=="")){//被保险人
						item12="";
					}
					$state.go('content_12_42_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy,item42 : item42,item12 : item12,policy:policy});
				}
				if(itemId=="17"){//额外投资
					var item17=itemData.item17;
					$state.go('content_17_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy,item17:item17});
				}
				if(itemId=="19"){//投资账户转换
					var item19=itemData.item19;
					$state.go('content_19_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy,item19:item19});
				}
				if(itemId=="20"){//投资账户选择
					var item20=itemData.item20;
					$state.go('content_20_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy,item20:item20});
				}
				if(itemId=="21"){//部分提取
					var item21=itemData.item21;
					$state.go('content_21_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy,item21:item21});
				}
				if(itemId=="23"){//复效
					var item23=itemData.item23;
					$state.go('content_23_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy,item23:item23});
				}
				if(itemId=="27"){//退保
					var item27=itemData.item27;
					$state.go('content_27_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy,item27:item27});
				}
				if(itemId=="28"){//保单借款
					var item28=itemData.item28;
					$state.go('content_28_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy,item28:item28});
				}
				if(itemId=="33"){//结束缓缴期
					var item33=itemData.item33;
					$state.go('content_33_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy, item33:item33});
				}
				if(itemId=="34"){//终止合同结清
					var item34=itemData.item34;
					$state.go('content_34_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy, item34:item34});
				}
				if(itemId=="35"){//补发保险合同
					$state.go('content_35_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy});
				}
				if(itemId=="36"){//进入保险费缓缴期
					$state.go('content_36_check',{
//						itemData:itemData,chdrnum01:chdrnum01,item:item
						chdrnum01 : chdrnum01,
						chdrcoy : chdrcoy
					});
				}
				if(itemId=="37"){//补缴保险费用
					var item37=itemData.item37;
					$state.go('content_37_check',{
						item37:item37,
						chdrnum01 : chdrnum01,
						chdrcoy : chdrcoy
					});
				}
				if(itemId=="38"){//进入保单还款
					var item38=itemData.item38;
					$state.go('content_38_check',{
						item38:item38,
						chdrnum01 : chdrnum01,
						chdrcoy : chdrcoy
					});
				}
				if(itemId=="39"){//进入生存给付
					var item39=itemData.item39;
					$state.go('content_39_check',{
						item39:item39,
						chdrnum01 : chdrnum01,
						chdrcoy : chdrcoy
					});
				}
				if(itemId=="40"){//生存领取方式   生存给付资料变更
					var item40=itemData.item40;
					$state.go('content_40_check',{
						item40:item40,
						chdrnum01 : chdrnum01,
						chdrcoy : chdrcoy
					});
				}
				if(itemId=="43"){//领取满期金  满期给付确认
					var item43=itemData.item43;
					$state.go('content_43_check',{
						item43:item43,
						chdrnum01 : chdrnum01,
						chdrcoy : chdrcoy
					});
				}
				if(itemId=="45"){//领取红利
					var item45=itemData.item45;
					$state.go('content_45_check',{
						item45:item45,
						chdrnum01 : chdrnum01,
						chdrcoy : chdrcoy
					});
				}

				if(itemId=="47"){//领取生存金
					var item47=itemData.item47;
					$state.go('content_47_check',{
						item47:item47,
						chdrnum01:chdrnum01,
						chdrcoy:chdrcoy
					});
				}

				if(itemId=="50"){//进入变更年金领取方式确认页面
					var item50=itemData.item50;
					$state.go('content_50_check',{
						itemId    : itemId,						
						chdrnum01 : chdrnum01,
						chdrcoy   : chdrcoy,
						item50    : item50
					});
				}					
				if(itemId=="52"){//续期缴费通知
					var item52=itemData.item52;
					$state.go('content_52_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy,item52:item52});
				}
				if(itemId=="54"){//信函接收方式
					var item54=itemData.item54;
					$state.go('content_54_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy,item54:item54});
				}
				if(itemId=="55"){//犹豫期退保
					var item55=itemData.item55;
					$state.go('content_55_check',{chdrnum01 : chdrnum01,chdrcoy : chdrcoy,item55:item55});
				}
                //S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20191225 start
                if (itemId == "15") { //保险计划
                    var item15 = itemData.item15;
                    $state.go('content_15_check', { chdrnum: chdrnum01, chdrcoy: chdrcoy, item15: item15});
                }
                if (itemId == "29") { //取消承保条件
                    var item29 = itemData.item29;
                    $state.go('content_29_check', { chdrnum: chdrnum01, chdrcoy: chdrcoy, item29: item29 });
                }
                if (itemId == "30") { //取消承保条件
                    var item30 = itemData.item30;
                    $state.go('content_30_check', { chdrnum: chdrnum01, chdrcoy: chdrcoy, item30: item30 });
                }
                //S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20191225 end
				
			}

			//保单详情弹窗
			$scope.showPolicyDetail = function(){
				modal('open','policyDetailModel','overwindowOnCheckMain','policyDetailCloseX');
				var timestamp=myFactory.getTimetamp();
				var sfis= "chdrnum-chdrcoy-token-timestamp";
				var signStr="chdrnum="+chdrnum01+"&chdrcoy="+chdrcoy+"&token="+token+"&timestamp="+timestamp;//encodeURI(name)
				var sign = myFactory.hex(signStr);
				//初始化查询订单详情
				var policyData;
				$http({
					method: 'GET',
					url: app.domain + 'query/restFindPolicyDetail.action',
					params: {'chdrnum': chdrnum01,'chdrcoy': chdrcoy,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
				}).then(function successCallback(response) {
					if (response.data.success) {
						policyData = response.data.data;
						$scope.policyData = policyData;
						$scope.policyData.ptdate01=myFactory.DateTools($scope.policyData.ptdate01);
					}
				}, function errorCallback(response) {
					$.alert({
						title: '',
						text: '初始化查询订单详情失败!',
						onOK: function () {
							//点击确认
						}
					});
				});

			}
			//保单详情弹窗关闭函数
			$scope.policyDetailCancel = function(){
				modal('close','policyDetailModel','overwindowOnCheckMain','policyDetailCloseX');
			}
//			//转人工审核弹框关闭函数，太鸡儿丑了，不用这个方法
//			$scope.BPopCance = function(){
//				modal('close','BPop','overwindowOnCheckMain','BPopCloseX');
//			}
			//提示电话为空弹框关闭函数，太鸡儿丑了，不用这个方法
//			$scope.telPopCancel = function(){
//				modal('close','telPop','overwindowOnCheckMain','telPopCloseX');
//			}
			//浙江单提示弹框关闭函数
			$scope.zhejiangPopCancel = function(){
				modal('close','zhejiangPop','overwindowOnCheckMain','zhejiangPopCloseX');
			}
			//查看受益人详情
			$scope.befDetailMode = function(index){
				modal('open','befPeopleModalOnCheckMain','overwindowOnCheckMain','befPeopleModalCloseXOnCheckMain');
				var befDetail = $scope.benefit[index];
				if (befDetail.availDataType == '1') {
					befDetail = JSON.parse(JSON.stringify(befDetail));
					befDetail.availDataClose = '';
				}
				$scope.befDetail = befDetail;
			}
			//受益人详情弹窗关闭函数
			$scope.befPeopleCancelOnCheckMain = function(){
				modal('close','befPeopleModalOnCheckMain','overwindowOnCheckMain','befPeopleModalCloseXOnCheckMain');
			}
			//生存给付详情弹框
			$scope.beneDetailModal = function(index){
				$("#beneClntDialogOnCheckMain").fadeToggle(50);
				
				//能点详情弹框触发这个函数说明已经有数据，不需要对数据进行判断，这里为具体读出数组第index个
				$scope.beneDetail = $scope.item39.beneList[index];
				
				$("#beneClntDialogOnCheckMain .myDialog_content .btn_close").click(function(){
					$(this).parents('#beneClntDialogOnCheckMain').fadeOut(50);
				});
				
				$("#beneClntDialogOnCheckMain .myDialog_black").click(function(){
					$(this).parent('#beneClntDialogOnCheckMain').fadeOut(50);
				});
			}
			//生存领取方式弹框
			$scope.beneDetailModalFor40Check = function(index){
				$("#beneDetailModalForItem40OnCheckMain").fadeToggle(50);
				
				//能点详情弹框触发这个函数说明已经有数据，不需要对数据进行判断，这里为具体读出数组第index个
				$scope.beneDetailForItem40 = $scope.item40.beneList[index];

				$("#beneDetailModalForItem40OnCheckMain .myDialog_content .btn_close").click(function(){
					$(this).parents('#beneDetailModalForItem40OnCheckMain').fadeOut(50);
				});
				
				$("#beneDetailModalForItem40OnCheckMain .myDialog_black").click(function(){
					$(this).parent('#beneDetailModalForItem40OnCheckMain').fadeOut(50);
					//$.toast("信函接收方式没有改变不需要改变", "text");
				});
			}
			//领取给付金 受益人详情触发函数
			$scope.expirationDetailDialog = function(index){
				//与生存领取方式弹框一样，这里直接引用生存领取方式的HTML元素
				$("#beneDetailModalForItem40OnCheckMain").fadeToggle(50);
				
				//能点详情弹框触发这个函数说明已经有数据，不需要对数据进行判断，这里为具体读出数组第index个
				$scope.beneDetailForItem40 = $scope.item43.showList[index];//虽然沿用生存领取方式的HTML元素，但注意数据来源不同

				$("#beneDetailModalForItem40OnCheckMain .myDialog_content .btn_close").click(function(){
					$(this).parents('#beneDetailModalForItem40OnCheckMain').fadeOut(50);
				});
				
				$("#beneDetailModalForItem40OnCheckMain .myDialog_black").click(function(){
					$(this).parent('#beneDetailModalForItem40OnCheckMain').fadeOut(50);
					//$.toast("信函接收方式没有改变不需要改变", "text");
				});
			}

			//领取生存金：详情
			$scope.benifidDetailMain = function(index){
				console.log("index:"+index);
				$("#get_survival_dialog1CheckMain").fadeToggle(50);

				var benifidContent = $scope.item47.beneList[index];

				$scope.clientNameContent=benifidContent.clientName;
				/*$scope.clientNoContent=benifidContent.clientNo;*/
				$scope.clientNoContent=benifidContent.idCard;//获取的是客户证件号码，不是客户号，客户号属于敏感数据

				$("#get_survival_dialog1CheckMain .myDialog_content .btn_close").click(function(){
					$(this).parents('#get_survival_dialog1CheckMain').fadeOut(50);
				});

				$("#get_survival_dialog1Main .myDialog_black").click(function(){
					$(this).parent('#get_survival_dialog1CheckMain').fadeOut(50);
				});
			}
			
			function showSingleItem(tempItemId) {
                //映射到页面
				if("01"==tempItemId){
					//$scope.showFlag=false;//显示多项变更内容列表
					//$scope.showContent01Flag=true;
					$("content01").show();
					$scope.item01 = itemData.item01;
					//同时变更保单字段一行三个保单号
					var strs01= new Array(); //定义一数组 
					strs01=itemData.item01.inPolicynos.split(","); //字符分割 
					for(var i=0;i<=strs01.length-1;i++){
						if(i!=strs01.length-1){
							strs01[i]=strs01[i]+',';
						}
					}
					$scope.strs01 = strs01;
				}
				if("02_1"==tempItemId){
					//$scope.showContent02_1Flag=true;
					$("content0201").show();
					$scope.item02_1 = itemData.item02_1;
					//同时变更保单字段一行三个保单号
					var strs02_1= new Array(); //定义一数组 
					strs02_1=itemData.item02_1.changechdrnums.split(","); //字符分割 
					for(var i=0;i<=strs02_1.length-1;i++){
						if(i!=strs02_1.length-1){
							strs02_1[i]=strs02_1[i]+',';
						}
					}
					$scope.strs02_1 = strs02_1;
					/*S2019042908337营运系统反洗钱工作差异分析系统优化需求  add by yangyan 20190712 start*/
					if ("" != itemData.item02_1.changeCon && null != itemData.item02_1.changeCon) {
						$scope.changeFlag = true;
					}
					/*S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by yangyan 20190712 end*/
				}
				if("02_2"==tempItemId){
					//$scope.showContent02_2Flag=true; //显示“进入终止续期转账授权”指令标签
					$("content0202").show();
					$scope.item02_2 = itemData.item02_2;
				}
				if("03"==tempItemId){
					//$scope.showContent03Flag=true; //显示“变更签名”指令标签
					$("content03").show();
					$scope.item03 = itemData.item03;
					if($scope.item03.signroleNm.trim()=="被保人签名"){
						$scope.item03.signroleNm = "被保险人签名";
					}
				}
				if("04"==tempItemId){
					//$scope.showContent04Flag=true; //显示“缴费方式”指令标签
					$("content04").show();
					$scope.item04 = itemData.item04;
					var b=$scope.item04.billFreq;
					if(b=="01"){
						//document.getElementById('jb').innerHTML="年缴";
						$scope.billFreqName="年缴";
					}
					if(b=="02"){
						$scope.billFreqName="半年缴";
					}
					if(b=="04"){
						$scope.billFreqName="季缴";
					}
					if(b=="12"){
						$scope.billFreqName="月缴";
					}
				}
				if("05"==tempItemId){
					//$scope.showContent05Flag=true; //显示“变更现金红利领取方式”指令标签
					$("content05").show();
					$scope.item05 = itemData.item05;
				}
				if("06"==tempItemId){
					//$scope.showContent06Flag=true; //显示“变更现金红利领取方式”指令标签
					$("content06").show();
					$scope.item06 = itemData.item06;
					var b=$scope.item06.autoPayFlag;
					if(b=="LAP"){
						$scope.payWay = "效力中止";
					}
					if(b=="APL"){
						$scope.payWay = "垫缴保费";
					}	
				}
				if("08"==tempItemId){
					//$scope.showContent08Flag=true; //显示“身故受益人”指令标签
					$("content08").show();
					$scope.benefit = itemData.item08.benefit;
				}
				if("10"==tempItemId){
					$scope.show10TbrFlag=false; //默认隐藏更改个人身份资料-投保人
					//$scope.showContent10Flag=true; //显示更改个人身份资料
					$("content10").show();
					//$scope.item10 = itemData.item10;
					$scope.item10 = itemData.item10;
					var clientCount=itemData.item10.clientCount;
					$scope.client_LF = itemData.item10.clientList[0];
					
					//日期显示方式处理 by zzq 2018-3-6
					$scope.client_LF.availDataClose = DateTools($scope.client_LF.availDataClose);
                	//S2020120315839_增加记录证件有效期起始日  add by mqz 20210125 start
                    $scope.client_LF.availDataStart = DateTools($scope.client_LF.availDataStart);
                	//S2020120315839_增加记录证件有效期起始日  add by mqz 20210125 end
					$scope.client_LF.birthDay = DateTools($scope.client_LF.birthDay);
					
					if(clientCount>1){
						$scope.show10TbrFlag=true; //显示更改个人身份资料-投保人
						$scope.client_OW = itemData.item10.clientList[1];
						
						//日期显示方式处理 by zzq 2018-3-6
						$scope.client_OW.availDataClose = DateTools($scope.client_OW.availDataClose);
                      //S2020120315839_增加记录证件有效期起始日  add by mqz 20210125 start
                        $scope.client_OW.availDataStart = DateTools($scope.client_OW.availDataStart);
                    	//S2020120315839_增加记录证件有效期起始日  add by mqz 20210125 end
						$scope.client_OW.birthDay = DateTools($scope.client_OW.birthDay);			
					}
				}
				if("12_42"==tempItemId){
					//$scope.showFlag=false;//显示多项变更内容列表
					//$scope.showContent12_42Flag=true;
					$("content1242").show();

                    //投/被保险人为同一人时，则只显示投保人信息
					//投/被保险人为同一人时，则只显示投保人勾选栏位
					//投保人证件号码
					var b=policy.base.secuityno;
					//被保人证件号码
					var b1=policy.base.rnIdNumber;
					var b2="";
					var b3="";
					//var applicant=itemData.applicant;
					//var benefitperson=itemData.benefitperson;
					var item42=itemData.item42;
					var item12=itemData.item12;
					if((item42!=undefined && item42!="")){//投保人
						b2=item42.servername;
					}
					if((item12!=undefined && item12!="")){//被保险人
						b3=item12.servername;
					}

					$scope.showTbrFlag_item42 = true;//默认显示投保人选项
					$scope.showBbrFlag_item12 = true;//显示被保人选项

					if(b==b1){
						$scope.showBbrFlag_item12 = false;//隐藏被保人选项
					}else{
						if(b3!=undefined && b3!=""){
							$scope.item12 = item12;
						}
					}
					if(b2==undefined || b2==""){
						$scope.showTbrFlag_item42 = false;//隐藏投保人选项
					}else{
						$scope.item42 = item42;
					}
					if(b3==undefined || b3==""){
						$scope.showBbrFlag_item12 = false;//隐藏被保人选项
					}else{
						$scope.item12 = item12;
					}

					/*if((b2!=undefined && b2!="")&&(b3==undefined || b3=="")){
						$scope.showBbrFlag_item12 = false;//隐藏被保人选项
						$scope.item42 = item42;
					} else if((b2==undefined || b2=="")&&(b3!=undefined && b3!="")){
						$scope.showBbrFlag_item12 = true;//显示被保人选项
						$scope.item12 = item12;
					} else {
						$scope.showBbrFlag_item12 = true;//显示被保人选项
						$scope.item42 = item42;
						$scope.item12 = item12;
					}*/
				}
				if("17"==tempItemId){
					//$scope.showContent17Flag=true; //额外投资
					$("content17").show();
					$scope.item17 = itemData.item17;
					//console.log($scope.item17);
					if($scope.item17.investList!=undefined && $scope.item17.investList!=null && $scope.item17.investList!=""){
						for(var i=0;i<$scope.item17.investList.length;i++){
							$scope.item17.investList[i].accountName=$scope.item17.investList[i].accountName.replace("投资账户","");
						}
					}
					var _productType = $scope.item17.productType;	//	产品类型
					//	存在投连产品时显示
					if( _productType.indexOf("U") > -1 ){
						//	取消隐藏
						$scope.InvAmntFlag = false; //万能区域，隐藏
						$scope.UniAmntFlag = true; //投连区域：金额，显示
						$scope.AcctFlag = true;    //投连区域：产品选择区域，显示

					}
					//	存在万能产品时显示		
					if( _productType.indexOf("W") > -1 ){
						//_InvAmnt.style.display ='';
						$scope.InvAmntFlag = true; //万能区域，显示
					}
				}
				if("19"==tempItemId){
					//$scope.showContent19Flag=true; //显示“投资账户转换”指令标签
					$("content19").show();
					var item19 = itemData.item19;
					$scope.saleAccountList = item19.saleAccountChanges.saleAccountList;
					$scope.buyAccountList = item19.buyAccountCounts.buyAccountList;
					
					for(var i=0;i<$scope.saleAccountList.length;i++){
						$scope.saleAccountList[i].saleAccountName=$scope.saleAccountList[i].saleAccountName.replace("投资账户","");
						//console.log($scope.saleAccountList[i].saleAccountName);
					}
					for(var i=0;i<$scope.buyAccountList.length;i++){
						$scope.buyAccountList[i].buyAccountName=$scope.buyAccountList[i].buyAccountName.replace("投资账户","");
						//console.log($scope.buyAccountList[i].buyAccountName);
					}
					
				}
				if("20"==tempItemId){
					//$scope.showContent20Flag=true; //显示“投资账户转换”指令标签
					$("content20").show();
					$scope.item20 = itemData.item20;
					for(var i=0;i<$scope.item20.length;i++){
						$scope.item20[i].accountName=$scope.item20[i].accountName.replace("投资账户","");
					}
				}
				if("21"==tempItemId){
					//$scope.showContent21Flag=true; //部分提取
					$("content21").show();
					$scope.item21 = itemData.item21;
					if($scope.item21.accountList!=undefined && $scope.item21.accountList!=null && $scope.item21.accountList!=""){
						for(var i=0;i<$scope.item21.accountList.length;i++){
							$scope.item21.accountList[i].accountDesc=$scope.item21.accountList[i].accountDesc.replace("投资账户","");
						}
					}
					var _productType = $scope.item21.productType;	//	产品类型
					
					//	存在投连产品时显示
					if( _productType.indexOf("U") > -1 ){
						//$("#showContentFor21Check").html("本变更项预计应退金额（元）"); 
						$scope.item21.itemFee.showContent = "本变更项预计应退金额（元）";
						//	取消隐藏
						$scope.investDiv21CheckFlag = true;
					}
					//	存在万能产品时显示		
					if( _productType.indexOf("W") > -1 ){
						$scope.universalDiv21CheckFlag = true;
					}
				}
				if("23"==tempItemId){
					//$scope.showContent23Flag=true; //显示“复效”指令标签
					$("content23").show();
					$scope.item23 = itemData.item23;
					var isAdd = $scope.item23.isAdd;
					$scope.show23bjItemFlag=false;
					if(isAdd!='O'){
						$scope.show23bjItemFlag=true;
						if(isAdd=='Y'){
							$scope.paymentOptions="补缴欠缴保险费";
						}else{
							$scope.paymentOptions="不补缴欠缴保险费";
						}
					}
				}
				if("27"==tempItemId){
					//$scope.showContent27Flag=true; //显示“退保”指令标签
					$("content27").show();
					$scope.item27 = itemData.item27;
					/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 start*/
					if ("" != itemData.item27.changeRelation && null != itemData.item27.changeRelation) {
						$scope.peoRelationFlag = true;
					}
					/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 end*/
					
					//S2019060408807保全退保项目删除预估应退金额需求 add by yangyan 20200213 start
					console.log("refundedFlag:" + itemData.item27.refundedFlag);
					if ('Y' == itemData.item27.refundedFlag) {
						$scope.refundedShowFlag = true;
					}
					//S2019060408807保全退保项目删除预估应退金额需求 add by yangyan 20200213 end
				}
				if("28"==tempItemId){
					//$scope.showContent28Flag=true; //显示“保单借款”指令标签
					$("content28").show();
					$scope.item28 = itemData.item28;
				}
				if("33"==tempItemId){
					//$scope.showContent33Flag=true; //显示“结束缓缴期”指令标签
					$("content33").show();
					$scope.item33 = itemData.item33;	
					if($scope.item33.switchInd == 'Y'){
						$scope.endType = true;
					}else if($scope.item33.switchInd == 'N'){
						$scope.endType = false;
					}
				}
				if("34"==tempItemId){
					//$scope.showContent34Flag=true; //显示“终止合同结清”指令标签
					$("content34").show();
					$scope.item34 = itemData.item34;
					/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 start*/
					if ("" != itemData.item34.changeRelation && null != itemData.item34.changeRelation) {
						$scope.peoRelationFlag = true;
					}
					/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 end*/
				}
				if("35"==tempItemId){
					//$scope.showFlag=false;//显示多项变更内容列表
					//$scope.showContent35Flag=true;
					$("content35").show();
					//$scope.itemData = itemData.item01;//没有item对象数据
				}
				if("36"==tempItemId){
					//$scope.showContent36Flag=true; //显示“进入保险费缓缴期”指令标签
					$("content36").show();
				}
				if("37"==tempItemId){ //补缴保险费用
					//$scope.showContent37Flag=true;
					$("content37").show();
					$scope.item37 = itemData.item37;
					for(var i=0;i<$scope.item37.investList.length;i++){
						$scope.item37.investList[i].investName=$scope.item37.investList[i].investName.replace("投资账户","");
					}
				}
				if("38"==tempItemId){ //进入保单还款
					//$scope.showContent38Flag=true;
					$("content38").show();
					$scope.item38 = itemData.item38;
					var payMoney = $scope.item38.bamount ; //还款金额
					var needPayMoney = $scope.item38.amount ; //需还款金额
					if(payMoney == needPayMoney){
						$scope.payTypeOnItem38 = "全额还款";
					}else{
						$scope.payTypeOnItem38 = "部分还款";
					}
				}
				if("39"==tempItemId){ //生存给付
					//$scope.showContent39Flag=true;
					$("content39").show();
					$scope.item39 = itemData.item39;
					/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 start*/
					if ("" != itemData.item39.changeRelation && null != itemData.item39.changeRelation) {
						$scope.peoRelationFlag = true;
					}
					/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 end*/
				}
				if("40"==tempItemId){ //生存领取方式变更
					//$scope.showContent40Flag=true;
					$("content40").show();
					$scope.item40 = itemData.item40;
					var value = $scope.item40.beneList[0].zdivOpt;
					if(value == 'CSWD'){//现金领取时，显示其他需要填写的信息
						$scope.FlagFor40Check = true;
					}else if(value == 'DVAC'){//储存生息/留存公司时候，隐藏其他需要填写的信息
						$scope.FlagFor40Check = false;
					}
					/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 start*/
					if ("" != itemData.item40.changeRelation && null != itemData.item40.changeRelation) {
						$scope.peoRelationFlag = true;
					}
					/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 end*/
				}
				if("43"==tempItemId){ //领取满期金   满期给付确认
					//$scope.showContent43Flag=true;
					$("content43").show();
					$scope.item43 = itemData.item43;
					/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 start*/
					if ("" != itemData.item43.changeRelation && null != itemData.item43.changeRelation) {
						$scope.peoRelationFlag = true;
					}
					/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 end*/
				}
				if("45"==tempItemId){ //领取红利
					//$scope.showContent45Flag=true;
					$("content45").show();
					$scope.item45 = itemData.item45;
				}
				if("47"==tempItemId){
					//$scope.showContent47Flag=true; //显示“领取生存金”指令标签
					$("content47").show();
					$scope.item47 = itemData.item47;
					/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 start*/
					if ("" != itemData.item47.changeRelation && null != itemData.item47.changeRelation) {
						$scope.peoRelationFlag = true;
					}
					/*S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by yangyan 20190712 end*/
				}
				//变更年金领取方式
				if("50"==tempItemId){
					//$scope.showContent50Flag=true; //显示“退保”指令标签
					$("content50").show();
					$scope.item50 = itemData.item50;
					var receiveType=$scope.item50.receiveType;
					if(receiveType=='01'){
						$scope.receiveTypeNme='年领';
					}else if(receiveType=='12'){
						$scope.receiveTypeNme='月领';
					}
				}					
				if("52"==tempItemId){  //续期缴费通知
					//$scope.showContent52Flag=true;
					$("content52").show();
					$scope.item52 = itemData.item52;
					//同时变更保单字段一行三个保单号
					var strs52= new Array(); //定义一数组 
					strs52=itemData.item52.inPolicynos.split(","); //字符分割 
					for(var i=0;i<=strs52.length-1;i++){
						if(i!=strs52.length-1){
							strs52[i]=strs52[i]+',';
						}
					}
					$scope.strs52 = strs52;
				}
				if("54"==tempItemId){
					//$scope.showContent54Flag=true; //显示“退保”指令标签
					$("content54").show();
					$scope.item54 = itemData.item54;
					var deliverOption=$scope.item54.deliverOption;
					if(deliverOption=='1'){
						$scope.deliverOptionContent='电子邮件';
					}else if(deliverOption=='2'){
						$scope.deliverOptionContent='纸质信函';
					}
				}
				if("55"==tempItemId){  //犹豫期退保
					//$scope.showContent55Flag=true;
					$("content55").show();
					$scope.item55 = itemData.item55;
				}
                //S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20191225 start 
                if ("15" == tempItemId) {
                    $("content15").show();
                    $scope.item15 = itemData.item15;
                    if ($scope.item15.benefit != null || $scope.item15.benefit != undefined) {
                    	if($scope.item15.benefit.length>0){
                    		$scope.newBenefit = true;
                        }
                    }
                    /*S2022013021184监管类-银行令〔2022〕1号营运相关系统功能需求 add by huanghaokun 20220315 start*/
                    if($scope.item15.reason!=null){
                   	 	$scope.reasonShow = true;
                    }
                    /*S2022013021184监管类-银行令〔2022〕1号营运相关系统功能需求 add by huanghaokun 20220315 end*/
                }
                if ("29" == tempItemId) {
                    $("content29").show();
                    $scope.item29 = itemData.item29;
                    $scope.item29.itemFee.showContent = "取消承保条件";
                }
                if ("30" == tempItemId) {
                    $("content30").show();
                    $scope.item30 = itemData.item30;
                }
                //S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20191225 end
            }

			//转换日期方法  例如：20170225--->2017-02-25 by zzq 2018-3-6
			function DateTools(date){
				date = String(date) ;//强转换成字符串，防止有些是数字格式过来后执行到下面replace报错
				if($.trim(date)!=""){
					return date.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1-$2-$3");
				}else{
					return date;
				}
			}
			
		}]);

        //详情指针
		app.directive('infoid',function(){
			return {
				restrict: 'EA',		//指明指令在DOM里面以什么形式被声明,EA.表示即可以是元素也可以是属性
				templateUrl: 'html/input/content_base_info.html'+'?datestamp=' + (new Date()).getTime(),
				replace: true,		//设置解析后，DOM声明的指令是否消失
				link: function(scope,element,attrs){  //链接函数负责注册DOM事件和更新DOM,
					console.log('弹框指令完成');
				}
			}
		});

})(app)